UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ao/PMCpRPQVY90D31lI2HDFFYT8m+oBpKtsJHwfInoM=' 
WHERE 
  key_id = 'a1598e214207eaa0aecf7b1664f437fc9c95550988c20497dd0548cea4cfa588' 
  AND (
    token = 'Ao/PMCpRPQVY90D31lI2HDFFYT8m+oBpKtsJHwfInoM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032