UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KR9cKw5r1l934yu7fFg3kUMRB7pST8bVbMjTxz/jrls='
WHERE
key_id = 'ff6348b2bae89487743e71dc3a3393f887f46a77ea49e9f659f303786062d210'
AND (
token = 'KR9cKw5r1l934yu7fFg3kUMRB7pST8bVbMjTxz/jrls='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)