UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BWD3ot4y2JEBlkdrR0bqxMCOteOyun4xJ0qDDxeQarE='
WHERE
key_id = '9849f79afc0ec1686e860fa13fafbaaacad42d87938c0e9dd1de605072d482d7'
AND (
token = 'BWD3ot4y2JEBlkdrR0bqxMCOteOyun4xJ0qDDxeQarE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)