UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x07rjM0M772nBE/8SaPxyDHwpgy6x3RzD9buoLkn/y0=' 
WHERE 
  key_id = '3334698584b7afa9bab4750246b444a39931b7644d4b119741f09ea20dc67dcd' 
  AND (
    token = 'x07rjM0M772nBE/8SaPxyDHwpgy6x3RzD9buoLkn/y0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021