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