UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B0Y4tk2z05bNG8n8oWJoBi64QYxo3iI4J+ekA+3ooc8='
WHERE
key_id = 'eac56ed9e01ba2135558ca62f60fe0d23dce81740c8eb4bab9cf4dd53346ebed'
AND (
token = 'B0Y4tk2z05bNG8n8oWJoBi64QYxo3iI4J+ekA+3ooc8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)