UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jtRvwJbv5azFrs+HYDetOJqBuE8yj+d5qRCTLY5hRWs='
WHERE
key_id = 'a8d03233777031a33f0ae0db6f72fe085dd0a6f50c893c9bae4d2a81bca23d29'
AND (
token = 'jtRvwJbv5azFrs+HYDetOJqBuE8yj+d5qRCTLY5hRWs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)