UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Qor6BcQeBVsE2L3AglhS2YTIO2qbnc7eFhnblsWbMNk='
WHERE
key_id = 'a31eb9aa469ce99c3581b736a6927c97181e5307ce9f6798e4225647e1a8da15'
AND (
token = 'Qor6BcQeBVsE2L3AglhS2YTIO2qbnc7eFhnblsWbMNk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)