UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'G7c6IKkrqn6weO0eLZex8ms2UaJvzP5vSoFZCYSrEEk='
WHERE
key_id = 'b9a4c767c4b9e2d75ef764e27c5eb43c7d2db14a90475d14240fd847c72d2093'
AND (
token = 'G7c6IKkrqn6weO0eLZex8ms2UaJvzP5vSoFZCYSrEEk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)