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