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