UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tij7EAcv5t5ftc/c0Imn7TgkQT+pBsPuu+pp5aujWlQ=' 
WHERE 
  key_id = 'e07626d4778fb513ad4dbc16b3a4132a04ab9bd829483396397f921134d91b1a' 
  AND (
    token = 'Tij7EAcv5t5ftc/c0Imn7TgkQT+pBsPuu+pp5aujWlQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037