UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ifb5VEPeZ39CFZ10TsK7RVT+b5Qe3IBXOWavz5iDVLU=' 
WHERE 
  key_id = '6829ae8cbb4aebf68155be3d690c4c065e2585c9172fea81d8cf4f0089968619' 
  AND (
    token = 'ifb5VEPeZ39CFZ10TsK7RVT+b5Qe3IBXOWavz5iDVLU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020