UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ef7VfEoul3KvYcQhH78l7qwkdK0oBZlZkGr4QGi1whg='
WHERE
key_id = '0e612f37641e28f5bf187ee06206d4e253e45de0096ab7fa7b985ec1d4eb53b5'
AND (
token = 'ef7VfEoul3KvYcQhH78l7qwkdK0oBZlZkGr4QGi1whg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)