UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dBmnpPs7ipd7mP7H794FwaOsgE07WJMxeRTTdmAohs8='
WHERE
key_id = '1b0bd88c67adf0b6d919204ac6115b3294f6c750cdc5872b416d555de4a2ee16'
AND (
token = 'dBmnpPs7ipd7mP7H794FwaOsgE07WJMxeRTTdmAohs8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)