UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n0URe0AEgTe7y+6ktNqxsrSwCQRyBp99N17of041zMM=' 
WHERE 
  key_id = '580b6b7d4a14965bafc23ff281540eab2d1a3090a03f8099e214940425773e87' 
  AND (
    token = 'n0URe0AEgTe7y+6ktNqxsrSwCQRyBp99N17of041zMM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036