UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IaIK8RWVVttiA7f48I0aKJZMLTfVN+oTOq7tipJqCnk=' 
WHERE 
  key_id = '88e96ae0833e3e1a245d763effa895fab305510d2002bad25d1cbeb911b0c266' 
  AND (
    token = 'IaIK8RWVVttiA7f48I0aKJZMLTfVN+oTOq7tipJqCnk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026