UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ldeoTgcHZe3cDRLX2ll8DHxytWKHuVSH8BXs4prBqz0=' 
WHERE 
  key_id = '112f30f4098a586f38254d0d6a1bfb77523de3c826e1f86bd7fa35b5b4856770' 
  AND (
    token = 'ldeoTgcHZe3cDRLX2ll8DHxytWKHuVSH8BXs4prBqz0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021