UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'baBQuPcllIUFrfElHstOX9xBMBJRZ0vMHqlJYwHKr6o='
WHERE
key_id = '692083332e58f18c7e34e7e164d1f7f78994fa163480dcb242fb012ccc89f1b0'
AND (
token = 'baBQuPcllIUFrfElHstOX9xBMBJRZ0vMHqlJYwHKr6o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)