UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cWj5Bpiu40efs0Wnttt/lTnTmwalhHa46SzPqMHhkzY=' 
WHERE 
  key_id = 'c3249e664360309dc4fb63285cdec05feec3b7c44edb4408f2c7cadd65ee9986' 
  AND (
    token = 'cWj5Bpiu40efs0Wnttt/lTnTmwalhHa46SzPqMHhkzY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033