UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hehC//qWuGx9RtU93isaA54Z94mr+zgG9HbJt8xyaxg='
WHERE
key_id = '00790a582eae7ac274bb92c624bb6930c419c9e07d702379da869b04887817a8'
AND (
token = 'hehC//qWuGx9RtU93isaA54Z94mr+zgG9HbJt8xyaxg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)