UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PGLBXUISqovRfBXGG0LslaJqyIFi0ctTKy4Bx2mEH0I=' 
WHERE 
  key_id = '74c3b111192ef759dc55400c66562d30bb26b482266aaaa7e0f280e80fd498e9' 
  AND (
    token = 'PGLBXUISqovRfBXGG0LslaJqyIFi0ctTKy4Bx2mEH0I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00063