UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xBkcmEsOvYmf0ZfzeNkKi1abF92+T18GkA2ss9bYzU8='
WHERE
key_id = 'eaf4161b2cfdad27aa9a22e2ceed9a67def99f7395521e3a7e6e7bae6ee9a392'
AND (
token = 'xBkcmEsOvYmf0ZfzeNkKi1abF92+T18GkA2ss9bYzU8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)