UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fIMgUO0sEtduymaP655ossVqPHpketQYWV+1mFTRo9Y='
WHERE
key_id = '39f39ecb27d2311007e434b55894d1b59261f6331752ef64101e352a87bbefd7'
AND (
token = 'fIMgUO0sEtduymaP655ossVqPHpketQYWV+1mFTRo9Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)