UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S5y4HHeTYRzu3mVBavOW/ghsqwUTx0F97YfMMJMv5EY='
WHERE
key_id = '6b399017da7a950c63414eef366d078e1f4f44a49643d40717b6d3b7ff7787f9'
AND (
token = 'S5y4HHeTYRzu3mVBavOW/ghsqwUTx0F97YfMMJMv5EY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)