UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'plQL861DtZ9U93mN37iz8ct5BCgxV0Ujc3dARWR77Hs=' 
WHERE 
  key_id = '000d7a636be68c0aec227a05fd57cf5c81a22536c991318dbf53ae1cbe00c8d2' 
  AND (
    token = 'plQL861DtZ9U93mN37iz8ct5BCgxV0Ujc3dARWR77Hs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025