UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BHUJHMZIdhkQSVAjOLrRmk/2Xw+CNd+66zrgxdv6bFk=' 
WHERE 
  key_id = '7c915c4ac74d232e261879052c008784f93f13db5f4d1e6722129e6cd10f9619' 
  AND (
    token = 'BHUJHMZIdhkQSVAjOLrRmk/2Xw+CNd+66zrgxdv6bFk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032