UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SDknepNECw+257Od06oHvwJK4laTpR1+IWQ4y+ENhUs=' 
WHERE 
  key_id = 'e6d753c780054cf663016acc78aff44754ceea49fbde7d494f78d2100852df29' 
  AND (
    token = 'SDknepNECw+257Od06oHvwJK4laTpR1+IWQ4y+ENhUs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036