UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A5wQ4rxhx++uNKF2XBpgWY0NqY52Itxa/viS7+tQhYE='
WHERE
key_id = 'ace9adecc17b16852f91d36a85c8697a4a15f10d44f5e6e1f0fa22f4970d22b2'
AND (
token = 'A5wQ4rxhx++uNKF2XBpgWY0NqY52Itxa/viS7+tQhYE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)