UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lRqayiP9jXXItM0/gLRnJ+BSXwVAaHwiFoiQyFyZ1us='
WHERE
key_id = 'a2a95ca0763997469091bd24daa4ac1c9eec1310593ccc44431c8d5d683acd95'
AND (
token = 'lRqayiP9jXXItM0/gLRnJ+BSXwVAaHwiFoiQyFyZ1us='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)