UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k2gssxZWxd+kblJv7H/StBlWkdCdu86uyZOfn0gKxhs=' 
WHERE 
  key_id = 'cc96ea10ab71333b84154b2371894db0ebb7639e6d455d58b92d59701a2b8547' 
  AND (
    token = 'k2gssxZWxd+kblJv7H/StBlWkdCdu86uyZOfn0gKxhs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031