UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2OfHZjgGtb7ij482soGbWfAfGc2wzrWpNI5OMlePcKY='
WHERE
key_id = 'c7cb4fcd7fff68b3eaf049a1085321a0b486714994636a6486a6e85fc080f09a'
AND (
token = '2OfHZjgGtb7ij482soGbWfAfGc2wzrWpNI5OMlePcKY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)